home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq15.zip / PCB.SLT < prev    next >
Text File  |  1991-01-09  |  18KB  |  506 lines

  1. //-----------------------------------------------------------
  2. // PCB.SL?    Telix script for logon to a PCBoard BBS.
  3. //
  4. // This script is normally called from the script LOGON.SLC.
  5. //
  6. // Please look at the comments through the whole file, and modify to
  7. // suit your needs, BEFORE you use it. Then recompile with CS PCB.
  8. //-----------------------------------------------------------
  9. // Author: Inge Vabekk
  10. //         Hamangskogen 108
  11. //         N-1300 SANDVIKA
  12. //         NORWAY
  13.  
  14. str thisBBStype[]="PCB"        // Must be PCB to work.
  15.    ,line      [80]             // Temporary line.
  16.    ,logfile   [64]             // Log file name.
  17.    ,catfile   [32]             // Catalog file name.
  18.    ,filelist  [12]             // Name of file list.
  19.    ,Sdoor      [2]             // and door to open
  20.    ,myprot     [2]             // My protocol
  21.    ,hisprot    [2]             // and BBS's prot. character.
  22.    ,command   [10]             // Current command prompt.
  23.                                // For the Global storage:
  24.    ,global      []="GLOBAL"    // Global script.
  25.    ,bbstype     []="BTYPE"     // BBS type.
  26.    ,short       []="SHORT"     // Short BBS name.
  27.    ,Cprot       []="CPROT"     // Current protocol.
  28.    ,Hprot       []="HPROT"     // "His" protocol.
  29.    ,passw       []="PASSW"     // Current password.
  30.    ,version     []="PCBVER"    // Current PCB version.
  31.    ,prompt      []="PROMPT"    // Current command prompt.
  32.    ,conf        []="CONF"      // Current conference.
  33.    ,filist      []="FILIST"    // Name of BBS file list.
  34.    ,mscript     []="MDOOR"     // Name of mail door/script.
  35.    ;     
  36.  
  37. int tol = 300                  // No activity for 30 sec.
  38.    ,tmark                      // makes script time out.
  39.    ,stat
  40.    ,door                       // Door number.
  41.    ,InDoor                     // TRUE if in door.
  42.    ,mega                       // MegaMail door.
  43.    ,MarkM                      // MarkMail door.
  44.    ,dbdoor                     // Dial-Back door.
  45.    ,PCBver                     // PCB version
  46.    ,first
  47.    ,cm                         // Trig on Command prompt
  48.    ,pm                         // Trig on "Personal Mail"
  49.    ,pw                         // Password trigger, carried over
  50.    ;                           // from the LOGON script.
  51.  
  52. //-----------------------------------------------------------
  53. // PCBOARD logon script entered here.
  54. // Note: The "pw" parameter contains trig number for an
  55. // additional password request from PCBoard (in case the
  56. // first attempt failed).
  57. //-----------------------------------------------------------
  58.  
  59. main (int pw1)
  60. {
  61. int i, m
  62.    ,error
  63.    ;
  64.  
  65.   pw = pw1;                              // Move parameter to global.
  66.   pm = track ("nter)=yes?",0);           // Start tracking this at once.
  67.  
  68.   first = 1;                             // First time on.
  69.   entry();                               // Update colors & status bar.
  70.  
  71. // Only if online.
  72.  
  73.   if (!carrier())  
  74.   { failtone();
  75.     status_wind ("THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  76.     return (-1);
  77.   }
  78.  
  79.   read (bbstype,line);                   // Get BBS type. 
  80.   if (line != thisBBStype)  
  81.   { wrongBBS();                          // Doesn't match script!
  82.     return (-1);
  83.   }
  84.  
  85.   read (filist,filelist);                // Get name of file list.
  86.   read (version,line);
  87.   PCBver = stoi (line);                  // Get PCB version.
  88.   write (conf,"Main Board");             // Always starts in this conf.
  89.  
  90.   command = "Command";                   // Set code for command prompt.
  91.   write (prompt,command);                // Start tracking NOW.
  92.  
  93.   cm = track (command,   0);             // Command.
  94.  
  95.   read (Cprot,myprot);
  96.   if (myprot=="1")
  97.     hisprot = "O";
  98.   else if (myprot=="Y")
  99.     hisprot = "YG";
  100.   else if (myprot=="D")
  101.     hisprot = "Z";
  102.   else
  103.     hisprot = myprot;
  104.   write (Hprot,hisprot);                 // Write BBS protocol.
  105.  
  106.   InDoor = PCBver < 100;                 // Entry from ProLgon:
  107.   if (PCBver > 144)                      // For PCBoard < 14.5 we should
  108.   { door = 0;                            // be in door already.
  109.     InDoor = 1;
  110.     i = strposi(_entry_name,"D:",0);     // Find door number from name.
  111.     if (i > 0) 
  112.     { substr (_entry_name,i+2,2,Sdoor);  // Copy max. 2 characters.
  113.       door = stoi(Sdoor);                // Find door number.
  114.       if (door != 0) InDoor = 0;
  115.     }
  116.   }
  117.   else                                   // ProLogon or PBCoard < 14.5:
  118.   { Sdoor = "1";                         // Door 1 is default.
  119.     door = 1;
  120.   }
  121.  
  122. // Start tracking incoming text. For ease of reading and programming,
  123. // and to improve speed, this is split into different sections.
  124. //-----------------------------------------------------------
  125.  
  126.   error = SECTION1();                    // Run section one.
  127.   release();
  128.  
  129. fail:
  130.   if (error)
  131.   { failtone();
  132.     status_wind ("Logon failed!",20);
  133.     return (-1);
  134.   }
  135.   itos (PCBver,line);                    // Update PCB version.
  136.   write (version,line);
  137.  
  138.   line="MAILUP";                         // ASCII upload mail.
  139.   if (MarkM)                             // Check which door.
  140.     line="MARKMAIL";                     // Chain to the MarkMail script.
  141.   else if (mega)
  142.     line="MEGAMAIL";                     // Chain to the MegaMail script.
  143.   else if (dbdoor)
  144.   { error = call ("DialBack");           // Chain to the DialBack script.
  145.     if (error) goto fail;                // Can't continue. 
  146.   }
  147.   write (mscript,line);                  // Write name of mail script.
  148.   if (first) first = GetPrompt();
  149.  
  150.   entry();
  151.   call ("JoinConf","Main Board");        // Back to Main Board.
  152.  
  153.   newfiles();                            // Go get new files.
  154.   return (0);
  155. }
  156.  
  157. //-----------------------------------------------------------
  158. // Section 1: Check any happenings before first command.
  159. //-----------------------------------------------------------
  160.  
  161. SECTION1()
  162. {
  163. int c                         // Single character.
  164.    ,lfs
  165.    ,error
  166.    ,novice                    // For tracking:
  167.    ,more                      // "More" prompt received if TRUE.
  168.    ,he                        // Help needed
  169.    ,en                        // ENTER to continue
  170.    ,ns                        // Non-stop request.
  171.    ,mo1                       // More?
  172.    ,mo2
  173.    ,lf                        // Linefeed.
  174.    ,dr1, dr2, dr3, dr4        // various doors.
  175.    ;
  176.  
  177.   mega=MarkM=dbdoor=more=novice = 0;     // Preset some.
  178.   dr2 = dr3 = dr4 = 0;
  179.   dr1 = track ("ProDoor ",0);            // ZIPM mail.
  180.   if (door > 1)
  181.   { dr2 = track ("M a r k M",0);         // MarkMail.
  182.     dr3 = track ("ing MEGA,",0);         // Megamail.
  183.     dr4 = track ("DB_DOOR ",0);          // Dial-Back door.
  184.   }
  185.   mo1 = track ("p, More?",0);            // More?
  186.   mo2 = track ("continue",0);            // More? 
  187.  
  188.   he = track (" for help",0);            // Novice.
  189.   
  190.   en = track ("to conti",0);             // Enter to continue
  191.   ns = track ("non-stop",0);             // Non-stop request?
  192.   lf = track ("^J",0);                   // Long list? (trig on LF)
  193.  
  194.   tmark = timer_start (100);             // Give me 10 sec.
  195.  
  196.   while ((stat=trig()) > 0)              // answer any logon questions
  197.   { if (stat == lf)                      // Linefeed?
  198.     { if (++lfs%5 == 0)                  // More than 5: Send break.
  199.         cputs ("^K");
  200.       continue;
  201.     }
  202.     else
  203.       lfs = 0;                           // Other trig: Reset lf count.
  204.  
  205.     if (stat==dr1 && !InDoor             // ProDoor? No mail?
  206.       && door != 1)
  207.       PCBver = 140;                      // Say version is old (14.0) 
  208.                                          // because we're in ProDoor.
  209.     else if (stat==dr1 || stat==dr2      // ProDoor? MarkMail?
  210.       || stat==dr3 || stat==dr4)         // MegaMail? Dial-Back?
  211.     { InDoor = 1;
  212.       track_free(dr1);                   // Free all tracks and timer.
  213.       if (dr2) track_free(dr2);
  214.       if (dr3) track_free(dr3);
  215.       if (dr4) track_free(dr4);
  216.       if (stat == dr1)
  217.         PCBver = 140;